package io.ouka.jvm.hotspot.selfread.read;

import io.ouka.jvm.hotspot.selfread.InstanceKlass;

/**
 * @author Ouka
 */
public abstract class AbstractReader implements IReader {

    protected final InstanceKlass parseContent(byte[] content){
        preRead(content);
        read();
        if (iReader!=null) iReader.parseContent(content);
        return instanceKlass;
    }

    protected AbstractReader iReader;

    static InstanceKlass instanceKlass = new InstanceKlass();

    public InstanceKlass getInstanceKlass() {
        return instanceKlass;
    }

    protected static  int index = 0;
    protected byte[] selfContent;

    public byte[] getSelfContent() {
        return selfContent;
    }

    public void setSelfContent(byte[] selfContent) {
        this.selfContent = selfContent;
    }

    public static int getIndex() {
        return index;
    }

    public static void addIndex(int len){
        index+=len;
    }
}
